package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum CouponsType {
	
	PLATFORM(0,"平台优惠券"),
	SHOP(1,"商户优惠券");
	
	private Integer value;
	
	private String text;

	private CouponsType(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public int toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static CouponsType toType(int value) {
		if (PLATFORM.value == value) {
			return PLATFORM;
		} else if(SHOP.value == value){
			return SHOP;
		} else {
			throw new InvalidArgumentException("Unknown CouponsType[" + value + "].");
		}
	}
}
